import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    isToken: true,
    userInfo: {
      name: '张三李四王二麻',
      roles: ['admin']
    },
    baseMenus: [
      {
        path: '/Home',
        name: '首页'
      }
    ],
    authList: [],
    admList: [
      {
        path: '/Product',
        name: 'Product',
        redirect: '/Product/Adm',
        children: [
          {
            path: '/Product/Adm',
            name: 'PAdm',
            component: () => import('../views/Product/Adm.vue')
          },
          {
            path: '/Product/Add',
            name: 'PAdd',
            component: () => import('../views/Product/Add.vue')
          }
        ]
      },
      {
        path: '/Staff',
        name: 'Staff',
        redirect: '/Staff/Adm',
        children: [
          {
            path: '/Staff/Adm',
            name: 'SAdd',
            component: () => import('../views/Staff/Adm.vue')
          }
        ]
      }
    ]
  },
  getters: {
    menusList: (state, getters, rootState, rootGetters) => {
      const menus = state.baseMenus.concat(state.admList)
      console.log(menus)
      return menus
    }
  },
  mutations: {
  },
  actions: {
    getRoutesList ({ commit, state }) {
    }
  },
  modules: {
  }
})
